﻿using Sc.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;

namespace Sc.Web.Controllers
{
    public class HomeController : BaseController
    {
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// Frame
        /// </summary>
        /// <returns></returns>
        public ActionResult Frame()
        {
            return View();
        }
        /// <summary>
        /// 菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult Left()
        {
            JavaScriptSerializer json = new JavaScriptSerializer();
            var data = new UserService().GetUserPermission(UserLogin.UserId);
            ViewData["permissions"] = json.Serialize(data);
            return View();
        }
        /// <summary>
        /// 顶部
        /// </summary>
        /// <returns></returns>
        public ActionResult Top()
        {
            ViewData["userName"] = UserLogin.UserName;
            return View();
        }
        /// <summary>
        /// 右边
        /// </summary>
        /// <returns></returns>
        public ActionResult Right()
        {
            return View();
        }
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <returns></returns>
        public ActionResult EditPwd()
        {
            return View();
        }
        /// <summary>
        /// 密码修改
        /// </summary>
        /// <param name="pwd">新密码</param>
        /// <returns></returns>
        public int UpdatePwd(string pwd)
        {
            return new UserService().UpdatePassword(UserLogin.UserId, pwd);
        }
	}
}